package org.domeos.framework.api.biz.productline.impl;

import java.util.List;

import org.domeos.framework.api.biz.base.impl.BaseBizImpl;
import org.domeos.framework.api.biz.productline.ProductLineBiz;
import org.domeos.framework.api.mapper.domeos.productline.ProductLineMapper;
import org.domeos.framework.api.model.productline.ProductLine;
import org.domeos.framework.api.model.productline.ProductLineTree;
import org.domeos.framework.engine.exception.DaoException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("productLineBiz")
public class ProductLineBizImpl extends BaseBizImpl implements ProductLineBiz {

	@Autowired
	ProductLineMapper productLineMapper;
	
	@Override
	public void addProductLine(ProductLine productLine) throws DaoException {
		productLineMapper.insertRecord(productLine);
	}

	@Override
	public ProductLine selectById(int id) throws DaoException {
		return productLineMapper.selectById(id);
	}

	@Override
	public void updateProductLine(ProductLine productLine) throws DaoException {
		productLineMapper.updateRecord(productLine);
	}

	@Override
	public List<ProductLineTree> selectByLevel(int level) throws DaoException {
		return productLineMapper.selectByLevel(level);
	}

	@Override
	public List<ProductLineTree> selectByPId(int pId) throws DaoException {
		return productLineMapper.selectByPId(pId);
	}

	@Override
	public int getCountById(int pId) throws DaoException {
		return productLineMapper.getCountById(pId);
	}
}
